<template>
  <Dialog
    class="two-columns"
    title="出库详情"
    :visible="visible"
    :reveal="false"
    :loading="loading"
    @close="handleClose"
  >
    <!-- 详情 -->
    <el-row type="flex">
      <el-col :span="12">领取单号：{{ detailsData.receiveCode }}</el-col>
      <el-col :span="12">来源：{{ detailsData.deptType }}</el-col>
    </el-row>
    <el-row type="flex">
      <el-col :span="12">申请方：{{ detailsData.deptName }}</el-col>
      <el-col :span="12">申领/开单人：{{ detailsData.receiveUsr }}</el-col>
      <!-- 科室领药没有顾客 -->
      <el-col v-if="detailsData.deptType==='科室领药'">顾客：{{ detailsData.customerName }}</el-col>
    </el-row>
    <el-table
      :data="detailsData.listDto"
      style="width: 100%;margin: 30px 0"
    >
      <el-table-column
        prop="name"
        label="名称"
        align="center"
      />
      <el-table-column
        prop="drugType"
        label="类型"
        align="center"
      />
      <el-table-column
        prop="specl"
        label="规格"
        align="center"
      />
      <el-table-column
        prop="unit"
        label="单位"
        align="center"
      />
      <el-table-column
        prop="dataCount"
        label="开单数量"
        align="center"
      />
      <!-- 已取消的详情，出库数量为空 -->
      <el-table-column
        prop="receiveCount"
        label="出库数量"
        align="center"
      />
    </el-table>
    <el-row type="flex">
      <!-- 已取消的之展示前两个 -->
      <el-col :span="6">仓库：{{ detailsData.writeoffName }}</el-col>
      <el-col v-if="detailsData.receiveStatus==='已取消'" :span="6">状态：{{ detailsData.receiveStatus }}</el-col>
      <el-col v-if="detailsData.receiveStatus!=='已取消'" :span="6">操作员：{{ detailsData.processor }}</el-col>
      <el-col v-if="detailsData.receiveStatus!=='已取消'" :span="8">出库时间：{{ detailsData.outStockDate }}</el-col>
    </el-row>
  </Dialog>
</template>
<script>
import Dialog from "@/components/Dialog/index";
export default {
  components: {
    Dialog,
  },
  data() {
    return {
      visible: false,
      loading: false,
      detailsData: {},
    };
  },
  methods: {
    deliveryDetails(id) {
      this.visible = true;
      this.loading = true;
      this.$api['warehouse/delivery/receiptDetails']({ id }).then((res) => {
        if (res.code !== 200) return this.$message.info('获取数据详情失败');
        this.loading = false;
        this.detailsData = res.data;
        console.log(res.data, "udhssjd什么v那是假的v");
      });
    },
    // 关闭
    handleClose() {
      this.loading = false;
      this.visible = false;
      this.detailsData = {};
    },

  },
};
</script>
<style lang="scss" scoped>
  /deep/.el-row{
    line-height: 35px;
  }
</style>
